<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <title>离职管理</title>
    <script type="text/javascript" src="../../js/boot.js"></script>
</head>
<body>
    <div class="mini-splitter" style="width: 100%; height: 100%;">
        <div size="240" showCollapseButton="true">
            <div class="mini-fit">
                <ul id="pageTree" class="mini-tree" style="width: 100%;" showTreeIcon="true" allowDrag="true" allowDrop="true" textField="departName"
                    idField="departID" resultAsTree="false">
                </ul>
            </div>
        </div>

        <div showCollapseButton="true">
            <fieldset id="fd1" style="width: 97%; margin-bottom: 10px;">
                <legend><span>查询条件</span></legend>
                <div id="queryForm" class="fieldset-body">
                    <table class="form-table" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="form-label">
                                <span>姓名：</span>
                                <div id="txtUserID" class="mini-autocomplete" emptyText="姓名/工号" style="width:150px;" popupWidth="200" textField="userName" valueField="userID">
                                    <div property="columns">
                                        <div header="姓名" field="userName" width="40"></div>
                                        <div header="工号" field="workNo"></div>
                                    </div>
                                </div>
                                <input id="comUserID" class="mini-combobox" textField="userName" valueField="userID" style="width: 150px" showNullItem="true" emptyText="请选择" nullItemText="请选择">
                                <span>审批状态：</span>
                                <input name="checkStatus" class="mini-combobox" textField="text" valueField="id" data="[{id:'0',text:'未审批'},{id:'1',text:'通过'},{id:'2',text:'未通过'}]" style="width: 150px">
                                <input name="orderby" value="checkTime,desc" class="mini-hidden" />
                                <a style="margin: 0 0 0 0;" class="mini-button" iconCls="icon-search" onclick="search()">查询</a>
                                <a class="mini-menubutton " menu="#popupMenu">编辑</a>
                                <ul id="popupMenu" class="mini-menu" style="display:none;">
                                    <li onclick="doEdit('add')">新增</li>
                                    <li onclick="doEdit('update')">修改</li>
                                    <li onclick="doDelete()">删除</li>
                                </ul>
                                <a class="mini-menubutton " menu="#popupMenu2">审批</a>
                                <ul id="popupMenu2" class="mini-menu" style="display:none;">
                                    <li iconCls="icon-search" onclick="checkAction('pass')">通过</li>
                                    <li iconCls="icon-ok" onclick="checkAction('nopass')">不通过</li>
                                </ul>
                            </td>
                        </tr>
                    </table>
                </div>
            </fieldset>

            <div class="mini-fit">
                <div id="datagrid" class="mini-datagrid" style="width:100%;height:100%;" pageSize="20" idField="instID" allowResize="true" multiSelect="true">
                    <div property="columns">
                        <div type="indexcolumn" width="20"></div>
                        <div type="checkcolumn" width="20"></div>
                        <div field="workNo" headerAlign="center" width="80">工号</div>
                        <div field="userName" headerAlign="center" width="80">姓名</div>
                        <div field="departName" headerAlign="center" width="80">部门名称</div>
                        <div field="postName" headerAlign="center" width="80">职务名称</div>
                        <div field="enterTime" dateFormat="yyyy-MM-dd" headerAlign="center" width="80">入职日期</div>
                        <div field="leaveTime" dateFormat="yyyy-MM-dd HH:mm:ss" headerAlign="center" width="80">离职日期</div>
                        <div field="leaveType" headerAlign="center" width="80">离职类型</div>
                        <div field="checkStatus" headerAlign="center" renderer="onStatusRenderer" width="60">审批状态</div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="detailWin" class="mini-window" style="width:800px;height:440px;" showMaxButton="true" showCollapseButton="true" showShadow="true"
         showToolbar="true" showFooter="true" showModal="true" allowResize="true" allowDrag="true">
        <div id="detailForm" style="padding:10px;">
            <input name="applyID" class="mini-hidden">
            <input name="userID" class="mini-hidden" id="userID">
            <table align="center">
                <tr>
                    <td align="right">姓名：</td>
                    <td align="left">
                        <div class="mini-autocomplete" id="user" emptyText="姓名/工号" style="width:150px;" popupWidth="200" textField="userName" valueField="userID" onvaluechanged="userChange1">
                            <div property="columns">
                                <div header="姓名" field="userName" width="40"></div>
                                <div header="工号" field="workNo"></div>
                            </div>
                        </div>
                    </td>
                    <td align="right">部门：</td>
                    <td align="left"><input name="departName" id="departName" class="mini-textbox" enabled="false"></td>
                    <td align="right">职务：</td>
                    <td align="left"><input name="postName" id="postName" class="mini-textbox" enabled="false"></td>
                </tr>
                <tr>
                    <td align="right">入职日期：</td>
                    <td align="left"><input name="enterTime" id="enterTime" class="mini-datepicker" format="yyyy-MM-dd" enabled="false"></td>
                    <td align="right">离职日期：</td>
                    <td align="left"><input name="leaveTime" class="mini-datepicker" format="yyyy-MM-dd"></td>
                    <td align="right">离职类型：</td>
                    <td align="left"><input name="leaveType" class="mini-combobox" data="CONST.get('quitTypes')" required="true"></td>
                </tr>
            </table>
            <div class="mini-tabs" activeIndex="0" id="tabs" style="width:550px;height:260px;margin-left: 90px;margin-top: 10px">
                <div title="本部门">
                    <table align="center">
                        <tr>
                            <td align="left" colspan="3">是否同意离职？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isAgree" id="isAgree"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">文件、相关资料、工厂出入证上交？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isDocumentation"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">工作服劳保、工具上交？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isTool"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">工作全部交接完毕？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isWork"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">项目号、资料交接齐全？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isProjectData"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">其他事项</td>
                            <td align="left" colspan="3">
                                <input name="departOtherItem" class="mini-textarea" style="width:300px;" vtype="maxLength:200"/>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">负责人：</td>
                            <td align="left"><input name="departCheckUserID" id="departCheckUserID" class="mini-combobox" textField="userName" valueField="userID"></td>
                            <td align="right">审核日期：</td>
                            <td align="left"><input name="departCheckTime" class="mini-datepicker" format="yyyy-MM-dd HH:mm" showTime="true" timeFormat="H:mm:ss"></td>
                        </tr>
                    </table>

                </div>
                <div title="行政部" >
                    <table align="center">
                        <tr>
                            <td align="left" colspan="3">退还公司钥匙？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isComkey"
                                     textField="text" valueField="id" value="3"
                                     data="[{id:3,text:'无'},{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">退回公司办公笔记本电脑？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isComputer"
                                     textField="text" valueField="id" value="3"
                                     data="[{id:3,text:'无'},{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">工作牌上交？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isWorkCard"
                                     textField="text" valueField="id" value="3"
                                     data="[{id:3,text:'无'},{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">公司手机上交？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isMobile"
                                     textField="text" valueField="id" value="3"
                                     data="[{id:3,text:'无'},{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">退还公司物资有</td>
                            <td align="left" colspan="3">
                                <input name="returnOtherGoods" class="mini-textarea" style="width:300px;" vtype="maxLength:200"/>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">负责人：</td>
                            <td align="left"><input name="administrationCheckUserID" id="administrationCheckUserID" class="mini-combobox" textField="userName" valueField="userID"></td>
                            <td align="right">审核日期：</td>
                            <td align="left"><input name="administrationCheckTime" class="mini-datepicker" format="yyyy-MM-dd HH:mm" showTime="true" timeFormat="H:mm:ss"></td>
                        </tr>
                    </table>
                </div>
                <div title="宿舍"  >
                    <table align="center">
                        <tr>
                            <td align="left" colspan="3">是否住宿人员？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isStay"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">是否搬离宿舍？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isMove"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">退还宿舍钥匙？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isBedksy"
                                     textField="text" valueField="id" value="3"
                                     data="[{id:3,text:'无'},{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">被褥床单交接？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isQuilt"
                                     textField="text" valueField="id" value="3"
                                     data="[{id:3,text:'无'},{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">其他事项</td>
                            <td align="left" colspan="3">
                                <input name="dormOtherItem" class="mini-textarea" style="width:300px;" vtype="maxLength:200"/>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">负责人：</td>
                            <td align="left"><input name="housemasterCheckUserID" id="housemasterCheckUserID" class="mini-combobox" textField="userName" valueField="userID"></td>
                            <td align="right">审核日期：</td>
                            <td align="left"><input name="housemasterCheckTime" class="mini-datepicker" format="yyyy-MM-dd HH:mm" showTime="true" timeFormat="H:mm:ss"></td>
                        </tr>
                    </table>
                </div>
                <div title="考勤" >
                    <table align="center">
                        <tr>
                            <td align="left" colspan="3">离职结算是否结清？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isWages"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">罚款是否结清？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isFine"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">与公司借款等账务是否结清？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isLendMoney"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">负责人：</td>
                            <td align="left"><input name="attendanceCheckUserID" id="attendanceCheckUserID" class="mini-combobox" textField="userName" valueField="userID"></td>
                            <td align="right">审核日期：</td>
                            <td align="left"><input name="attendanceCheckTime" class="mini-datepicker" format="yyyy-MM-dd HH:mm" showTime="true" timeFormat="H:mm:ss"></td>
                        </tr>
                    </table>
                </div>
                <div title="人事部" >
                    <table align="center">
                        <tr>
                            <td align="left" colspan="3">社保是否扣清，离职后的社保是否全额扣除？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isSocial"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">其他事项</td>
                            <td align="left" colspan="3">
                                <input name="hrOtherItem" class="mini-textarea" style="width:300px;" vtype="maxLength:200"/>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">负责人：</td>
                            <td align="left"><input name="hrCheckUserID" id="hrCheckUserID" class="mini-combobox" textField="userName" valueField="userID"></td>
                            <td align="right">审核日期：</td>
                            <td align="left"><input name="hrCheckTime" class="mini-datepicker" format="yyyy-MM-dd HH:mm" showTime="true" timeFormat="H:mm:ss"></td>
                        </tr>
                    </table>
                </div>
                <div title="财务部" >
                    <table align="center">
                        <tr>
                            <td align="left" colspan="3">离职结算工资及补贴（含各项补偿金）：</td>
                            <td align="right"><input name="settleWage" class="mini-textbox" vtype="float" value="0">元</td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">结算方式</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="settleType"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'现金'},{id:2,text:'银行卡'},{id:3,text:'统一结算'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">其他事项</td>
                            <td align="left" colspan="3">
                                <input name="financeOtherItem" class="mini-textarea" style="width:300px;" vtype="maxLength:200"/>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">负责人：</td>
                            <td align="left"><input name="financeCheckUserID" id="financeCheckUserID" class="mini-combobox" textField="userName" valueField="userID"></td>
                            <td align="right">审核日期：</td>
                            <td align="left"><input name="financeCheckTime" class="mini-datepicker" format="yyyy-MM-dd HH:mm" showTime="true" timeFormat="H:mm:ss"></td>
                        </tr>

                    </table>
                </div>
                <div title="总经理" >
                    <table align="center">
                        <tr>
                            <td align="left" colspan="3">是否同意离职？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isAgreeQuit"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="3">是否同意财务结算？</td>
                            <td align="right">
                                <div class="mini-radiobuttonlist" repeatLayout="table"
                                     name="isAgreeSettle"
                                     textField="text" valueField="id" value="1"
                                     data="[{id:1,text:'是'},{id:2,text:'否'}]" >
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">总经理：</td>
                            <td align="left"><input name="gmCheckUserID" id="gmCheckUserID" class="mini-combobox" textField="userName" valueField="userID" ></td>
                            <td align="right">审核日期：</td>
                            <td align="left"><input name="gmCheckTime" class="mini-datepicker" format="yyyy-MM-dd HH:mm" showTime="true" timeFormat="H:mm:ss"></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <div property="footer" style="text-align:center;padding:5px;padding-right:15px;">
            <a class="mini-button" iconCls="icon-save" id="submitButton" onClick="saveAction()">提交</a>
            <a class="mini-button" iconCls="icon-cancel" onClick="cancel()">取消</a>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    var quitTypes =[{id: '1', text: '辞职'},{id: '2', text: '辞退'},{id: '3', text: '解雇'},{id: '4', text: '试用期不合格'},{id: '5', text: '其它'}]
    miniInit();

    var userID = null;
    var localUser = mini.decode(localStorage.getItem('user'));
    if (localUser == null) {
        mini.alert("你还没有登录，请先登录再操作...");
    }
    // 如果是普通用户，使用下拉选择控件，把本人及本人的手下加载进来
    else {
        userID = localUser.userID;
        if (localUser.roleID == "normalUser") {
            mini.get("txtUserID").setVisible(false);
            var comUserID = mini.get("comUserID");
            comUserID.setName("userID");
            http.get("/oa/quit/getUserListByLeader.do?userID="+userID, function (data) {
                if (data.length > 0) {
                    comUserID.setData(data);
                    comUserID.select(0);
                    comUserID.on("valuechanged", function (e) {
                        // var user = e.selected;
                        search();
                    });
                }
            });
        }
        // 如果是平台管理员，使用自动补全控件
        else {
            mini.get("comUserID").setVisible(false);
            var txtUserID = mini.get("txtUserID");
            txtUserID.setName("userID");
            txtUserID.set({
                url: http.getUrl("/oa/quit/getUserList.do")
            });

        }
    }

    var tree = mini.get("pageTree");

    var detailForm = new mini.Form("#detailForm");
    var detailWin = mini.get("detailWin");

    // 加载浅蓝色背景和去除滚动条
    $('.mini-splitter').addClass('bg');
    //$('.fieldset-body-body').addClass('bg');

    tree.url = http.getUrl("/sys/depart/list.do");
    tree.load(tree.url);

    var editNode = null; // 当前编辑的节点
    /*********************************************************
     * 左侧目录树的鼠标点击事件
     *********************************************************/
    tree.on("nodedblclick", function (e) {
        // debugger
        editNode = e.node;
        tree.loadNode(editNode);
        if (editNode) {
            // search();
        }
    });

    function userChange1(e) {
        var user = e.selected;
        console.log(user)
        if (user!=undefined){
            mini.get("userID").setValue(user.userID);
            mini.get("departName").setValue(user.departName);
            mini.get("postName").setValue(user.postName);
            mini.get("enterTime").setValue(user.enterTime);
        }
    }

    var queryForm = new mini.Form("#queryForm");
    var datagrid = mini.get("datagrid"); // 表定义列表
    datagrid.set({
        url: http.getUrl("/oa/quit/page.do")
    });
    datagrid.load();

    function search() {
        var data = queryForm.getData(true, false);
        var node = tree.getSelectedNode();
        if (node) {
            data["departID"] = node.departID;
            data["departID_link"] = "like";
        }
        // debugger
        // 如果角色是普通用户
        if (localUser.roleID == "normalUser") {
            data["condition"] = "userID='#userID#' or checkUserID='#userID#'";
        }
        data["orderby"] = "checkTime,desc";
        datagrid.load(data, null, miniui.showLoadErrorMessageBox);
    }

    datagrid.on("drawcell",function(e) {
        var record = e.record, column = e.column, field = e.field, value = e.value;
        if(field=="leaveType"&&value!=null){
            e.cellHtml = common.getDetail(quitTypes,"id",value).text;
        }
        if(field=="checkStatus"&&value!=null){
            if(value==0){
                e.cellHtml = "未审批";
            }else if(value==1){
                e.cellHtml = "通过";
            }else{
                e.cellHtml = "未通过";
            }
        }

    });

    /*********************************************************
     * 操作方法
     *********************************************************/
    function doEdit(type) {
        // debugger
        var tabs = mini.get("tabs");
        if (type == 'add') {
            if (localUser == null && localUser.userID == null) {
                alert("你还没有登录");
                return;
            }
            detailWin.setTitle("新增");
            detailForm.reset();

            var user = mini.get("user");
            user.setName("userID");
            user.set({
                url: http.getUrl("/oa/quit/getUserList.do")
            });
            mini.get("departCheckUserID").set({ url: http.getUrl("/oa/quit/getUserListByDepart.do")});
            mini.get("administrationCheckUserID").set({ url: http.getUrl("/oa/quit/getUserListByDepart.do")})
            mini.get("housemasterCheckUserID").set({ url: http.getUrl("/oa/quit/getUserListByDepart.do")})
            mini.get("attendanceCheckUserID").set({ url: http.getUrl("/oa/quit/getUserListByDepart.do")})
            mini.get("hrCheckUserID").set({ url: http.getUrl("/oa/quit/getUserListByDepart.do")})
            mini.get("financeCheckUserID").set({ url: http.getUrl("/oa/quit/getUserListByDepart.do")})
            mini.get("gmCheckUserID").set({ url: http.getUrl("/oa/quit/getUserListByDepart.do")})
            mini.get("submitButton").setEnabled(true);
        } else {

            if (datagrid.getSelected() == undefined) {
                mini.alert("请先选择要编辑的数据!", "提示", null);
                return;
            }
            var row = datagrid.getSelected();
            var user = mini.get("user");
            user.setValue(row.userID);
            user.setText(row.userName);
            detailWin.setTitle("修改");
            detailForm.setData(row);

        }
        var tab = tabs.getTab (0);//获取面板对象
        tabs.activeTab(tab);//切换到指定面板
        detailWin.showAtPos('center', 'middle');
    }

    function saveAction() {
        if (detailForm.validate()) {
            miniui.mask("数据保存中...");
            var data = detailForm.getData(true, false);
            console.log(data)
            http.post("/oa/quit/save.do", data, function (page) {
                mini.unmask();
                detailWin.hide();
                if (page.success) {
                    miniui.showSuccessTip("保存成功");
                    datagrid.reload();
                } else {
                    miniui.showErrorMessageBox(page.message);
                }
            });
        }
    }

    function cancel() {
        detailWin.hide();
    }

    function doDelete() {
        if (datagrid.getSelected()) {
            mini.confirm("确定要删除选中的记录吗？", "确定？",
                    function (action) {
                        if (action == "ok") {
                            var row = datagrid.getSelected();
                            if (userID != row.userID) {
                                miniui.showErrorMessageBox("对不起，你不能删除别人申请的记录！");
                                return;
                            }
                            if (row.status == 1) {
                                miniui.showErrorMessageBox("对不起，已经通过的申请不能删除！");
                                return;
                            }
                            var data = {
                                "applyID": row.applyID
                            };
                            http.post("/oa/quit/delete.do", data, function (page) {
                                if (page.success) {
                                    miniui.showSuccessTip("删除成功");
                                    datagrid.removeRow(row);
                                } else {
                                    miniui.showErrorMessageBox(page.message);
                                }
                            });
                        }
                    });
        } else {
            miniui.showErrorMessageBox("请先选择要删除的记录！");
        }
    }

    function checkAction(type) {
        if (localUser == null && localUser.userID == null) {
            alert("你还没有登录");
            return;
        }
        var userID = localUser.userID;
        var status = 1;
        if (type == 'pass') {
            status = '1';
        } else {
            status = '2';
        }
        var list = datagrid.getSelecteds();
        if (list.length == 0) {
            miniui.showErrorMessageBox("请先选择要审批的数据...");
            return;
        }
        miniui.mask("数据保存中...");
        var ids = common.getListKeys(list, "applyID");
        var data = {
            "status": status,
            "ids": ids
        }
        http.post("/oa/quit/check.do", data, function (page) {
            mini.unmask();
            if (page.success) {
                miniui.showSuccessTip("保存成功");
                datagrid.reload();
            } else {
                miniui.showErrorMessageBox(page.message);
            }
        });
    }

</script>